package com.designPatterns.singleton.client;

import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

/**
 * Created by houjinxin on 16/3/5.
 */
public class ConcurrentClient {


    public static void main(String[] args) {

        ExecutorService executor = Executors.newFixedThreadPool(10);
        List<InstanceTask> tasks = new ArrayList<>();
        InstanceTask task = null;
        for (int i = 0; i < 10; i++){
            task = new InstanceTask();
            executor.submit(task);
            if (i == 5){
                executor.shutdownNow();
            }
        }
//        executor.shutdown();
    }
}
